<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>复杂的标签实现演示</title>
</head>
<body>

<p><h2> 简单例子 </h2><p>
标签:
&lt;#simple>hello&lt;/#simple>
<p>输出:<#simple>hello</#simple></p>
<p>==========================</p>

<p>实现：simple.tag</p>
<pre>
&lt;b>\${tag.body}&lt;/b>
</pre>
<p>==========================</p>

<p></p>
<p><h2> 绑定例子</h2> <p>
<p>==========================</p>
标签:<p>
&lt;#data var="name,index">
name=\${name},index=\${index}.
&lt;/#data>
<p>输出：</p>
<#data var="name,index">
name=${name},index=${index}.
</#data>

<p>实现：data.tag</p>
<pre>
\<%
var name="ok";
var index = 1;
//绑定
@tag.binds(name,index);
for(var i=0;i<2;i++){
	//执行标签体
%>
    \${tag.body} 
\<%}%>
</pre>
<p>==========================</p>

<p></p>
<p>标签嵌套例子,实现请查看源码tags\table.tag</p>
<p>==========================</p>
<%
var data = [{id:1,name:'你好'},{id:2,name:'他好'}];
%>
<#table data="${data}" var="row">
	<#tr name="编号">${row.id}</#tr>
	<#tr name="名称">${row.name}</#tr>

</#table>
<p></p>
<p>==========================</p>
<p>标签嵌套例子+beetl脚本,实现请查看源码tags\table.tag</p>
<p> 标签 </p>
<pre>
\<%
var data1 = [{id:1,name:'你好'},{id:2,name:'他好'}];
var showId = false ;
%>
&lt;#table data="\${data1}" var="row">
	\<%if(showId){%>
	&lt;#tr name="编号">\${row.id}&lt/#tr>
	\<%}%>
	&lt;#tr name="名称">\${row.name}&lt/#tr>
&lt;/#table>
</pre>
<p>输出</p>
<%
var data1 = [{id:1,name:'你好'},{id:2,name:'他好'}];
var showId = false ;
%>
<#table data="${data1}" var="row">
	<%if(showId){%>
	<#tr name="编号">${row.id}</#tr>
	<%}%>
	<#tr name="名称">${row.name}</#tr>
</#table>
<p>==========================</p>
</body>
</html>